<?		
	require('../lib/adodb5/adodb.inc.php');
	require('../lib/util.php');

	//$id = isset($_GET['id']) ? (int)$_GET['id'] : null;
	$id = null;
	$history = isset($_GET['history']) ? $_GET['history'] : null;	
	$name = isset($_GET['name']) ? $_GET['name'] : null;
	//$allottedTime = isset($_GET['allottedTime']) ? $_GET['allottedTime'] : null;
	$allottedTime = null;
 	$description = isset($_GET['description']) ? $_GET['description'] : null;
	$type = isset($_GET['type']) ? $_GET['type'] : null;
	$begin = date('Y-m-d', time());
	
	$db = abreConexao();
		
	$sql = "INSERT INTO task 
			VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
		
	$param = array($id, $history, $name, $taskStatus['ToDo'], $type, $description, $allottedTime, $begin, null);
	
	$db->StartTrans();
	
	$result = $db->Execute($sql, $param);
	$insertId = $db->Insert_ID();
	
	$db->CompleteTrans();
	
	if (!$result) {
		die('error inserting: '.$db->ErrorMsg());		
	}
	
	echo $insertId;
?>